package com.onpositive.gamemaker.android;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;

import com.onpositive.gamemaker.core.GraphicDevice;
import com.onpositive.gamemaker.visualizer.HexagonMath;

public class AndroidGraphicDevice extends GraphicDevice{

	Canvas canvas;
	Paint p=new Paint();
	
	@Override
	public void drawHexImage(String imageId, int x, int y, int width, int height) {
		Bitmap bitmap = AndroidImageManager.get(imageId);
		Paint paint=null;
		canvas.drawBitmap(bitmap, null, new Rect(x, y, x+width, y+height), paint);
	}

	@Override
	public void drawHexGrid(int x, int y, int radius) {
		int[] hexagonCoordArray = HexagonMath.getHexagonCoordArray(x, y, radius);
		float[] d=new float[hexagonCoordArray.length];
		for (int a=0;a<d.length;a++){
			d[a]=hexagonCoordArray[a];
		}
		canvas.drawLines(d,p);
	}

	@Override
	public void drawImage(String imageId, int x, int y, int width, int height) {
		Bitmap bitmap = AndroidImageManager.get(imageId);
		Paint paint=null;
		canvas.drawBitmap(bitmap, null, new Rect(x, y, x+width, y+height), paint);	
	}

}
